﻿// CLoginDlg.cpp: 实现文件
//

#include "pch.h"
#include "MFCApplication1.h"
#include "CLoginDlg.h"
#include "afxdialogex.h"


// CLoginDlg 对话框

IMPLEMENT_DYNAMIC(CLoginDlg, CDialogEx)

CLoginDlg::CLoginDlg(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_LOGIN_DLG, pParent)
{

}

CLoginDlg::~CLoginDlg()
{
}

void CLoginDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CLoginDlg, CDialogEx)
	ON_BN_CLICKED(IDOK, &CLoginDlg::OnBnClickedOk)
END_MESSAGE_MAP()


// CLoginDlg 消息处理程序


void CLoginDlg::OnBnClickedOk()
{
	CString sName, sPass;
	GetDlgItemText(IDC_SNAME, sName);
	GetDlgItemText(IDC_PASS, sPass);
	if (sName == L"abc" && sPass == L"123")
	{
		this->EndDialog(IDOK);
	}
	else
	{
		MessageBox(L"您输入的用户名或密码有误，请重新输入", L"提示", MB_OK | MB_ICONINFORMATION);
		SetDlgItemText(IDC_SNAME, L"");
		SetDlgItemText(IDC_PASS, L"");
		GetDlgItem(IDC_SNAME)->SetFocus();
	}
}
